Skip to content

Declare public resources from images that are loaded by name#45421

Closed
Abbondanzo wants to merge 2 commits into
facebook:mainfrom
Abbondanzo:export-D59585555
Closed

Declare public resources from images that are loaded by name#45421
Abbondanzo wants to merge 2 commits into
facebook:mainfrom
Abbondanzo:export-D59585555

Conversation

@Abbondanzo
Copy link
Copy Markdown
Contributor

Summary:
RNTester contains Android resources that are loaded by name and not resolved by Metro. As a result, these assets are not automatically linked when RNTester JS code is embedded in other projects. This is considered "legacy" loading and is generally discouraged, but is still showcased as an alernative way of loading resources.

I also modified the Image test to ensure that flag status is printed so it's obvious why the vector drawable hasn't loaded.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59585555

Summary:
Fresco has indicated that they have no plans to support loading vector assets and similar drawable types in Drawee-backed views ([issue](facebook/fresco#329), [issue](facebook/fresco#1463), [issue](facebook/fresco#2463)). Guidance has been to instead load the vector drawable onto the backing image view ourselves. On the React Native side, having the ability to load vector drawables has been requested many times ([issue](facebook#16651), [issue](facebook#27502)).

I went this route over using a custom Fresco decoder for XML assets because vector drawables are compiled down into binary XML and I couldn't find a trivial, performant way to parse those files in a context-aware manner. This change only accounts for vector drawables, not any of the other XML-based drawable types (layer lists, level lists, state lists, 9-patch, etc.). Support could be added easily in the future by expanding the `getDrawableIfUnsupported` function.

## Changelog

[Android] [Added] - Added support for rendering XML assets provide to `Image`

Differential Revision: D59530172
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 12, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59585555

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59585555

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jul 12, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 21,368,741 +1,373
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 24,565,306 +1,129
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 9d8e52b
Branch: main

…k#45421)

Summary:
Pull Request resolved: facebook#45421

RNTester contains Android resources that are loaded by name and not resolved by Metro. As a result, these assets are not automatically linked when RNTester JS code is embedded in other projects. This is considered "legacy" loading and is generally discouraged, but is still showcased as an alernative way of loading resources.

I also modified the Image test to ensure that flag status is printed so it's obvious why the vector drawable hasn't loaded.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59585555
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59585555

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 15, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 018d062.

@github-actions
Copy link
Copy Markdown

This pull request was successfully merged by Peter Abbondanzo in 018d062

When will my fix make it into a release? | How to file a pick request?

@Abbondanzo Abbondanzo deleted the export-D59585555 branch October 11, 2024 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants